#ifndef __ZEVENT_CSTRING_HPP
#define __ZEVENT_CSTRING_HPP
#include <array>
#include <string_view>

namespace zevent {
template <std::size_t N> struct KString {
  consteval explicit(false) KString(char const (&str)[N]) {
    for (auto i = std::size_t{}; i < N; ++i) {
      value[i] = str[i];
    }
  }

  consteval explicit(true) KString(char const *str, std::size_t sz) {
    for (auto i = std::size_t{}; i < sz; ++i) {
      value[i] = str[i];
    }
  }

  constexpr static std::integral_constant<std::size_t, N - 1U> size{};
  constexpr static std::integral_constant<bool, N == 1U> empty{};

  constexpr explicit(true) operator std::string_view() const {
    return std::string_view{std::cbegin(value), size()};
  }

  std::array<char, N> value{};
};

} // namespace zevent
#endif // !__ZEVENT_KSTRING_HPP
